package com.iweb;

import java.util.ArrayList;

public class Demo3 {
    public static void main(String[] args) {
        ArrayList<Integer> list = new ArrayList<>();

        while (list.size()<20){
            //生成随机数
           int num= (int) (Math.random()*50);
           if (!list.contains(num)){
               list.add(num);
           }
        }
        for (Integer i:list){
            System.out.println(i);
        }
    }
}
